import { TypedUseSelectorHook, useSelector, useDispatch } from 'react-redux';
import rootReducer from './reducer';
import { legacy_createStore as createStore } from 'redux';
const store = createStore(rootReducer);
export default store;

//取出state 的类型
export type RootState = ReturnType<typeof store.getState>;

//取出dispatch的类型
export type AppDispatch = typeof store.dispatch;
export const useAppDispatch: () => AppDispatch = useDispatch;
//取出getState的类型
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;
